package com.diqye.config;

import com.diqye.controller.blog.Blog;
import com.diqye.controller.blog.table.blog_tab;
import com.diqye.controller.blog.table.review_tab;
import com.diqye.controller.intercepter.ValidateLogin;
import com.diqye.controller.user.User;
import com.diqye.controller.wjdc.Question;
import com.diqye.db.XConf;
import com.diqye.db.datasources.SimpleDatasource;
import com.diqye.db.event.impl.AutoPrimary;
import com.diqye.db.manage.XManage;
import com.diqye.engine.Constant;
import com.diqye.engine.Constant.InterceptorKit;
import com.diqye.engine.Route;
import com.diqye.engine.RouteActions;

public class AppConfig extends Route {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public void initAction(RouteActions a) {
		
//		a.add("menu", Menu.class, "viewMenuForTree");
//		a.add("queryMenu",Menu.class,"queryMenu");
//		a.add("addMenu",Menu.class,"addMenu");
//		a.add("saveContent",Menu.class,"addMenuContentForKnowledge");
//		a.add("loadContent",Menu.class,"loadContent");
//		a.add("testExam",Menu.class,"testExam");
		
		a.add(User.class);
		a.add(Blog.class);
		a.add(Question.class);
	}

	@Override
	public void initInterceptor(InterceptorKit a) {
		XConf.defaultDataSource=new SimpleDatasource();
//		XManage.addTableEvent(test_tab.class, new TableEventSaveForNextPrimaryKey());
//		a.add(new SimpleValidator(this.getClass().getResourceAsStream("validator.json")));
		a.add(new ValidateLogin());
		XManage.addTableEvent(blog_tab.class, new AutoPrimary());
		XManage.addTableEvent(review_tab.class, new AutoPrimary());
	}

	@Override
	public void initConstant(Constant a) {
		// TODO Auto-generated method stub
		
	}
	

}
